package org.ywf.common.converter;

import cn.hutool.core.bean.BeanUtil;
import org.mapstruct.Mapper;
import org.ywf.common.request.JHNewsReq;
import org.ywf.common.request.NewsReq;
import org.ywf.common.response.JHNewsRes;
import org.ywf.common.response.NewsRes;

@Mapper(componentModel = "spring")
public interface NewsConverter extends ProxyConverter<JHNewsReq, NewsReq,JHNewsRes,NewsRes>{

    @Override
    default JHNewsReq convertReq(NewsReq request){
        JHNewsReq jhNewsReq = new JHNewsReq();
        if (request != null){
            BeanUtil.copyProperties(request, jhNewsReq);
        }
        return jhNewsReq;
    }

    @Override
    default NewsRes convertRes(JHNewsRes response){
        NewsRes newsRes = new NewsRes();
        if (response != null){
            BeanUtil.copyProperties(response,newsRes);
        }
        return newsRes;
    }

}
